<template>
    <div class="boundedwork newsafework">
        <div class="content">
            <div class="c-top">
                <div class="c-list">
                    <div class="c-left">
                        项目名称
                    </div>
                    <div class="c-right">
                        <!-- {{dataList.projectName}} -->
                        {{userInfo.departsir == 2?userInfo.pdeptname:dataList.projectName}}
                    </div>
                </div>
                <div class="c-list"
                     @click="showclass">
                    <div class="c-left">
                        申请使用单位
                        <i class="iconfont icon-required"></i>
                    </div>
                    <div class="c-right">
                        <div class="c-select">
                            <input v-if="!dataList.deptName"
                                   type="text"
                                   placeholder="请选择"
                                   disabled/>
                            <span v-else>{{dataList.deptName}}</span>
                        </div>
                        <i class="iconfont icon-jinru rightmsg"></i>
                    </div>
                </div>
                <div class="c-list"
                     @click="showArea">
                    <div class="c-left">
                        高风险作业区域
                        <i class="iconfont icon-required"></i>
                    </div>
                    <div class="c-right">
                        <div class="c-select">
                            <input v-if="!dataList.OperationArea"
                                   type="text"
                                   placeholder="请选择"
                                   disabled/>
                            <span v-else>{{dataList.OperationArea}}</span>
                        </div>
                        <i class="iconfont icon-jinru rightmsg"></i>
                    </div>
                </div>
                <div class="c-list"
                     @click="showperson">
                    <div class="c-left">
                        责任人
                        <i class="iconfont icon-required"></i>
                    </div>
                    <div class="c-right">
                        <div class="c-select">
                            <input v-if="!dataList.PersonLiable"
                                   type="text"
                                   placeholder="请选择"
                                   disabled/>
                            <span v-else>{{dataList.PersonLiable}}</span>
                        </div>
                        <i class="iconfont icon-jinru rightmsg"></i>
                    </div>
                </div>
                <div class="c-l-l">
                    <div class="c-left"
                         style="display:inline-block">
                        设备名称及编号
                        <i class="iconfont icon-required"></i>
                    </div>
                    <textarea maxlength="50"
                              v-model="dataList.EquipmentName"
                              placeholder="请输入设备名称及编号（自行换行）"
                              class="textarea"></textarea>
                </div>
                <div class="c-l-l">
                    <div class="c-left"
                         style="display:inline-block">
                        额定荷载
                        <i class="iconfont icon-required"></i>
                    </div>
                    <textarea maxlength="50"
                              v-model="dataList.RatedLoad"
                              placeholder="请输入额定荷载（自行换行）"
                              class="textarea"></textarea>
                </div>
                <div class="c-l-l">
                    <div class="c-left"
                         style="display:inline-block">
                        吊物名称及重量

                        <i class="iconfont icon-required"></i>
                    </div>
                    <textarea maxlength="50"
                              v-model="dataList.LiftNameWeight"
                              placeholder="请输入吊物名称及重量（自行换行）"
                              class="textarea"></textarea>
                </div>
                <div class="c-list"
                     @click="showEle">
                    <div class="c-left">
                        设备操作人员
                        <i class="iconfont icon-required"></i>
                    </div>
                    <div class="c-right">
                        <div class="c-select">
                            <input v-if="!dataList.DeviceOperator"
                                   type="text"
                                   placeholder="请选择"
                                   disabled/>
                            <span v-else>{{dataList.DeviceOperator}}</span>
                        </div>
                        <i class="iconfont icon-jinru rightmsg"></i>
                    </div>
                </div>
                <div class="c-l-l">
                    <div class="c-left"
                         style="display:inline-block">
                        设备操作人员上岗证号
                        <i class="iconfont icon-required"></i>
                    </div>
                    <textarea v-model="dataList.CardNumber1"
                              maxlength="50"
                              placeholder="请输入设备操作人员上岗证号（自行换行）"
                              class="textarea"></textarea>
                </div>
                <div class="c-list"
                     @click="showline">
                    <div class="c-left">
                        信号司索工
                        <i class="iconfont icon-required"></i>
                    </div>
                    <div class="c-right">
                        <div class="c-select">
                            <input v-if="!dataList.SignalSiSuogong"
                                   type="text"
                                   placeholder="请选择"
                                   disabled/>
                            <span v-else>{{dataList.SignalSiSuogong}}</span>
                        </div>
                        <i class="iconfont icon-jinru rightmsg"></i>
                    </div>
                </div>
                <div class="c-l-l">
                    <div class="c-left"
                         style="display:inline-block">
                        信号司索上岗证号
                        <i class="iconfont icon-required"></i>
                    </div>
                    <textarea v-model="dataList.CardNumber2"
                              placeholder="请输入意见（自行换行）"
                              class="textarea"></textarea>
                </div>
                <div class="c-list"
                     style="padding:0 20px 0 0">
                    <div class="c-left">
                        作业开始日期
                        <i class="iconfont icon-required"></i>
                    </div>
                    <div class="c-right">
                        <!-- <datetime v-model="dataList.startDate"
                                  @on-change="changestart"
                                  format="YYYY-MM-DD"
                                  title='开始时间'>
                            <div class="showlisttime">
                                {{dataList.startDate}}
                            </div>
                        </datetime> -->
                        <datetime v-model="dataList.startDate"
                                  @on-change="changestart"
                                  placeholder="请选择"
                                  format="YYYY-MM-DD"></datetime>
                    </div>
                </div>
                <div class="c-list"
                     style="padding:0 20px 0 0">
                    <div class="c-left">
                        作业结束日期
                        <i class="iconfont icon-required"></i>
                    </div>
                    <div class="c-right">
                        <!--<div class="c-select">请选择</div>
                     <img src="../../../../static/images/5.png"  @click="showmsg" >-->

                        <!-- <datetime :start-date="startDateOn"
                                  @on-change="changeend"
                                  v-model="dataList.endDate"
                                  format="YYYY-MM-DD"
                                  title='结束时间'>
                            <div class="showlisttime">
                                {{dataList.endDate}}
                            </div>
                        </datetime> -->
                        <datetime :start-date="startDateOn"
                                  v-model="dataList.endDate"
                                  @on-change="changeend"
                                  placeholder="请选择"
                                  format="YYYY-MM-DD"></datetime>
                    </div>
                </div>
            </div>

            <!--<div class="c-btn">

             <div class="c-submit">提交</div>

         </div>-->
            <div class="c-bottom">
                <div class="c-title">
                    是否符合开工条件
                </div>
                <div class="showlist"
                     v-for="(item,index) in subProjectsList"
                     :key="index">
                    <group>
                        <popup-radio :title="item.DeptName"
                                     :options="options1"
                                     v-model="item['Item'+item.DeptId]"></popup-radio>
                    </group>
                </div>
            </div>
            <div class="c-top">
                <div class="c-l-l">
                    <div class="c-left"
                         style="display:inline-block">
                        其他防护措施
                        <i class="iconfont icon-required"></i>
                    </div>
                    <textarea v-model="dataList.remark"
                              placeholder="请输入意见（自行换行）"
                              class="textarea"></textarea>
                </div>
            </div>

            <!-- 审批信息 -->
            <div class="approveBox"
                 v-if='approveStatus'>
                <div class="approveTit">审批信息</div>
                <div class="approveWrap"
                     v-if='dataList.ApproveInfo.length>0'
                     v-for="(item,index) in dataList.ApproveInfo"
                     :key="index">
                    <div class="form-item form-item-style2">
                        <div class="label-title">
                            <label>审批意见</label>
                        </div>
                        <div>
                            <textarea class="areainfo"
                                      height="500"
                                      placeholder="请输入审批意见"
                                      v-model="item.Remark"
                                      :disabled="isDisable"></textarea>
                        </div>
                    </div>
                    <div class="form-item form-item-style1">
                        <div class="label-title">
                            <label>审批结论</label>
                        </div>
                        <div class="newcompanyList approvehide">
                            {{item.ApproveResult}}
                        </div>
                    </div>
                    <div class="form-item form-item-style1">
                        <div class="label-title">
                            <label>审批人</label>
                        </div>
                        <div class="newcompanyList approvehide">
                            {{item.ApprovePersonName}}
                        </div>
                    </div>
                </div>
            </div>

            <div class="c-btn"
                 v-if="syself">
                <div class="c-submit"
                     @click="showsunbit">提交</div>

            </div>
        </div>

        <!--获取区域-->
        <div v-transfer-dom>
            <popup v-model="areaValue"
                   width="100%">
                <div class="position-horizontal-demo"
                     v-for="(item,index) in areaList"
                     :key="index"
                     @click="selectArea(item)">
                    <span class="vux-close">
                        {{item.name}}
                    </span>
                </div>
            </popup>
        </div>
        <!--获取责任人-->
        <div v-transfer-dom>
            <popup v-model="personValue"
                   width="100%">
                <div class="position-horizontal-demo"
                     v-for="(item,index) in personList"
                     :key="index"
                     @click="selectPerson(item)">
                    <span class="vux-close">
                        {{item.realName}}
                    </span>
                </div>
            </popup>
        </div>
        <!--获取班组-->
        <div v-transfer-dom>
            <popup v-model="classValue"
                   width="100%">
                <!--<div class="position-horizontal-demo" v-for="(item,index) in classList" @click="selectClass(item)">
            <span class="vux-close">
                {{item.deptName}}
            </span>
          </div>-->

                <div class="newlist">
                    <lookcompany></lookcompany>
                </div>
            </popup>
        </div>
        <!--获取设备操作人员-->
        <div v-transfer-dom>
            <popup v-model="seteleValue"
                   width="100%">
                <div class="position-horizontal-demo"
                     v-for="(item,index) in workList0"
                     :key="index"
                     @click="selectEle(item)">
                    <span class="vux-close">
                        {{item.name}}
                    </span>
                </div>
            </popup>
        </div>

        <!--获取信号索工-->
        <div v-transfer-dom>
            <popup v-model="lineValue"
                   width="100%">
                <!-- <div class="newlistdemo"
                     @click="lineValue = false">
                    确认
                </div>
                <div class="vux-popup-dialog-content"> -->
                <div class="position-horizontal-demo"
                     v-for="(item,index) in workList1"
                     :key="index"
                     @click="selectline(item,index)">
                    <span class="vux-close">
                        {{item.name}}
                    </span>
                    <x-icon type="ios-checkmark-empty"
                            size="30"
                            v-if="checklist[index]"></x-icon>
                </div>
                <!-- </div> -->
            </popup>
        </div>

        <myMenu></myMenu>
    </div>
</template>

<script>
import { Group, PopupRadio, TransferDom, Popup } from 'vux'
import myMenu from '@/commonComponents/menu'
import lookcompany from './lookcompany'
import mixin from '../commonmixin.js'
const getDate = () => {
    var date = new Date()
    var seperator1 = '-'
    var year = date.getFullYear()
    var month = date.getMonth() + 1
    var strDate = date.getDate()
    if (month >= 1 && month <= 9) {
        month = '0' + month
    }
    if (strDate >= 0 && strDate <= 9) {
        strDate = '0' + strDate
    }
    var currentdate = year + seperator1 + month + seperator1 + strDate
    return currentdate
}

const endDate = () => {
    var date = new Date()
    var seperator1 = '-'
    var year = date.getFullYear()
    var month = date.getMonth() + 1
    var strDate = date.getDate()
    if (month >= 1 && month <= 9) {
        month = '0' + month
    }
    if (strDate >= 0 && strDate <= 9) {
        strDate = '0' + strDate
    }
    var currentdate = year + seperator1 + month + seperator1 + strDate
    return currentdate
}
export default {
    name: 'App',
    directives: {
        TransferDom
    },
    mixins: [mixin],
    data () {
        return {
            options1: ['是', '否'],
            options2: ['安全类'],
            active: 1,
            showflag: false,

            dataList: {
                id: '', //	String	否	起重吊装作业申请ID（修改时存在，新增时为空）
                projectName: '', //	String	否	项目名称
                projectId: '', //	String	否	项目ID
                deptName: '', //	String	否	申请单位名称
                deptId: '', //	String	否	申请单位ID
                startDate: getDate(), //	String	否	申请拆除日期
                endDate: endDate(), //	String	否	计划完工时间
                DismantlingPart: '', //	String	否	拆除部位
                DesignLabel: '', //	String	否	设计砼标号
                remark: '', //	String	否	浇筑砼日期
                PersonLiable: '', //	String	否	责任人
                PersonLiableid: '', //	String	否	责任人ID
                EquipmentName: '', //	String	否	设备名称及编号
                RatedLoad: '', //	String	否	额定荷载
                LiftNameWeight: '', //	String	否	吊物名称及重量
                OperationArea: '', //	String	否	作业区域
                DeviceOperator: '', //	String	否	设备操作人
                DeviceOperatorid: '', //	String	否	设备操作人ID
                CardNumber1: '', //	String	否	上岗证号1
                SignalSiSuogong: '', //	String	否	信号司索工
                SignalSiSuogongid: '', //	String	否	信号司索工ID
                CardNumber2: '', //	String	否	上岗证号2
                personId: '', //	String	否	申请人ID
                personName: '', //	String	否	申请人名称
                subProjects: ''
            },
            areaValue: false,
            personValue: false,
            classValue: false,
            seteleValue: false,
            lineValue: false,
            areaList: [],
            personList: [],
            classList: [],
            areaname: '',
            checklist: [],
            startDateOn: getDate(),
            subProjects: {},
            subProjectsList: [],
            theModel: [],
            crr: '',
            yself: true,
            addflag: true,
            approveStatus: false, // 是否展示审批信息
            isDisable: true,
            syself: true,
            userInfo: '',
            workList0: [],
            workList1: []
        }
    },
    components: {
        Group, PopupRadio, Popup, lookcompany, myMenu
    },
    computed: {
        changedata () {
            return this.$store.state.workrist
        }
    },
    watch: {
        changedata () {
            this.classValue = false
            this.dataList.deptName = this.$store.state.companyworklist.deptName
            this.dataList.deptId = this.$store.state.companyworklist.deptId
            this.getPersonPage(0)
            this.getPersonPage(3)
        }
    },
    created () {
        this.userInfo = JSON.parse(localStorage.userInfo)
        this.dataList = Object.assign({}, this.dataList, {
            projectName: this.userInfo.deptname,
            projectId: this.userInfo.deptid
        })

        if (this.$route.query.id) {
            this.getdetail()
        } else {
            this.changemove()
        }
        this.getArea()
        this.getPerson()
        this.getClass()
        // this.changemove();
    },
    methods: {
        showsunbit () {
            console.log(this.subProjectsList)
            let crr = {}
            this.subProjectsList.forEach( // 获取
                (item) => {
                    crr['Item' + item.DeptId] = item['Item' + item.DeptId]
                }
            )
            console.log(crr)
            this.dataList.subProjects = crr

            if (!this.dataList.deptName) {
                this.$vux.toast.text('请选择申请单位')
                return false
            }
            if (!this.dataList.OperationArea) {
                this.$vux.toast.text('请选择高风险作业区域')
                return false
            }
            if (!this.dataList.PersonLiable) {
                this.$vux.toast.text('请选择责任人')
                return false
            }
            if (!this.dataList.EquipmentName) {
                this.$vux.toast.text('请输入设备名称及编号')
                return false
            }
            if (!this.dataList.RatedLoad) {
                this.$vux.toast.text('请输入设备名称及编号')
                return false
            }
            if (!this.dataList.LiftNameWeight) {
                this.$vux.toast.text('请输入吊物名称及重量')
                return false
            }
            if (!this.dataList.DeviceOperator) {
                this.$vux.toast.text('请选择设备操作人员')
                return false
            }
            if (!this.dataList.CardNumber1) {
                this.$vux.toast.text('请选择设备操作人员上岗证号')
                return false
            }
            if (!this.dataList.SignalSiSuogong) {
                this.$vux.toast.text('请选择信号司索工')
                return false
            }
            if (!this.dataList.CardNumber2) {
                this.$vux.toast.text('请选择信号司索上岗证号')
                return false
            }
            if (!this.dataList.startDate) {
                this.$vux.toast.text('请选择作业开始日期')
                return false
            }
            if (!this.dataList.endDate) {
                this.$vux.toast.text('请选择作业结束日期')
                return false
            }
            if (!this.dataList.remark) {
                this.$vux.toast.text('请选择其他防护措施')
                return false
            }
            let sendmethod = 'send'
            // if(this.$route.query.id){
            //     sendmethod = "modify";
            // }
            if (!this.addflag) {
                return false
            }
            this.addflag = false
            this.$vux.loading.show({
                text: '正在提交中...'
            })
            let param = {
                'allowPaging': true,
                'business': 'SetHoistingJob',
                'method': sendmethod,
                'data': this.dataList,
                'pageIndex': 0,
                'pageSize': 20,
                'tokenId': this.tokenId,
                'userId': this.userId
            }
            this.$axiosAjax.getConfigJson(
                param
            ).then(
                (res) => {
                    if (res.data.code == 0) {
                        this.$router.push('/workrisk')
                    } else {
                        this.addflag = true
                    }
                    // this.areaList = res.data.data
                }
            ).catch(() => {
                this.addflag = true
            })
        },
        changemove () { // 获取开工条件
            let param = {
                'allowPaging': true,
                'business': 'GetHoistingJobItem',
                'data': {
                    'deptId': this.userInfo.deptid,
                    'deptName': this.userInfo.deptname
                },
                'pageIndex': 0,
                'pageSize': 20,
                'tokenId': this.tokenId,
                'userId': this.userId
            }
            this.$axiosAjax.getConfigJson(
                param
            ).then(
                (res) => {
                    this.subProjectsList = res.data.data
                    this.subProjectsList = []
                    let arr = res.data.data
                    arr.forEach(
                        (item, index) => {
                            let items = {}
                            items['Item' + item.DeptId] = '是'
                            this.subProjectsList[index] = Object.assign({}, item, items)
                        }
                    )
                    //  this.subProjectsList = [...arr];
                    console.log(this.subProjectsList)
                }
            )
        },
        changemovenew () { //
            let param = {
                'allowPaging': true,
                'business': 'GetHoistingJobItem',
                'data': {
                    'deptId': this.userInfo.deptid,
                    'deptName': this.userInfo.deptname
                },
                'pageIndex': 0,
                'pageSize': 20,
                'tokenId': this.tokenId,
                'userId': this.userId
            }
            this.$axiosAjax.getConfigJson(
                param
            ).then(
                (res) => {
                    //  this.subProjectsList = res.data.data;
                    this.subProjectsList = []
                    let arr = res.data.data
                    arr.forEach(
                        (item, index) => {
                            let items = {}
                            items['Item' + item.DeptId] = this.crr['Item' + item.DeptId]
                            this.subProjectsList[index] = Object.assign({}, item, items)
                        }
                    )
                    //  this.subProjectsList = [...arr];
                    console.log(this.subProjectsList)
                }
            )
        },
        getPerson () {
            let param = {
                'allowPaging': true,
                'business': 'GetDivderPeopleList',
                'data': {
                    'departId': this.userInfo.deptid
                },
                'pageIndex': 0,
                'pageSize': 20,
                'tokenId': this.tokenId,
                'userId': this.userId
            }
            this.$axiosAjax.getConfigJson(
                param
            ).then(
                (res) => {
                    this.personList = res.data.data
                }
            )
        },
        getClass () {
            let param = {
                'allowPaging': true,
                'business': 'GetDeparts',
                'data': {
                    'deptId': this.userInfo.deptid
                },
                'pageIndex': 0,
                'pageSize': 20,
                'tokenId': this.tokenId,
                'userId': this.userId
            }
            this.$axiosAjax.getConfigJson(
                param
            ).then(
                (res) => {
                    this.classList = res.data.data
                    this.theModel = this.totree(res.data.data)
                }
            )
        },
        showArea () {
            this.areaValue = true
        },
        showmsg () {

        },
        selectArea (item) {
            //  this.areaname = item.name;
            this.dataList.OperationArea = item.name
            this.areaValue = false
        },

        showperson () {
            this.personValue = true
        },
        selectPerson (item) {
            this.dataList.PersonLiable = item.realName
            this.dataList.PersonLiableid = item.memberId
            this.personValue = false
        },
        showclass () {
            this.classValue = true
        },
        selectClass (item) {
            this.dataList.deptName = item.deptName
            this.dataList.deptId = item.deptId
            this.classValue = false
        },
        showEle () {
            if (this.dataList.deptId) {
                this.seteleValue = true
            } else {
                this.$vux.toast.text('请选择申请使用单位')
            }
        },
        selectEle (item) {
            this.dataList.DeviceOperator = item.name
            this.dataList.DeviceOperatorid = item.id
            this.dataList.CardNumber1 = item.no
            this.seteleValue = false
        },
        showline () {
            if (this.dataList.deptId) {
                this.lineValue = true
            } else {
                this.$vux.toast.text('请选择申请使用单位')
            }
        },
        selectline (items, index) {
            console.log(index)
            // this.checklist[index] = !this.checklist[index]
            // let typeNamelist = []
            // let typeLists = []
            // this.checklist.forEach(
            //     (item, index1) => {
            //         if (item) {
            //             typeNamelist.push(this.workList[index1].name)
            //             typeLists.push(this.workList[index1].id)
            //         }
            //     }
            // )
            // this.dataList.SignalSiSuogong = typeNamelist.join(',')
            // this.dataList.SignalSiSuogongid = typeNamelist.join(',')
            this.dataList.SignalSiSuogong = items.name
            this.dataList.SignalSiSuogongid = items.id
            this.dataList.CardNumber2 = items.no
            this.lineValue = false
            this.$forceUpdate()
        },
        changestart (val) {
            this.dataList.startDate = val
            let x = new Date(val).getTime() - new Date(this.showsearch.endDate).getTime()
            if (x > 0) {
                this.showsearch.endDate = val
            }
            this.startDateOn = val

            this.$forceUpdate()
        },
        changeend (val) {
            this.dataList.endDate = val
            this.$forceUpdate()
        },
        totree (list) {
            let id,
                deptName
            // list.forEach(
            //     (item) => {
            //         if (item.type == 1) {
            //             id = item.deptId
            //             deptName = item.deptName
            //         }
            //     }
            // )
            for (var i = 0; i < list.length; i++) {
                if (list[i].type == 1) {
                    id = list[i].deptId
                    deptName = list[i].deptName
                    break
                }
                if (list[i].type == 2) {
                    id = list[i].deptId
                    deptName = list[i].deptName
                    break
                }
            }
            let root = null
            if (list && list.length) {
                root = { deptId: id, parentId: null, deptName: deptName, children: [] }
                const group = {}
                for (let index = 0; index < list.length; index += 1) {
                    if (list[index].parentId !== null && list[index].parentId !== undefined) {
                        if (!group[list[index].parentId]) {
                            group[list[index].parentId] = []
                        }
                        group[list[index].parentId].push(list[index])
                    }
                }
                const queue = []
                queue.push(root)
                while (queue.length) {
                    const node = queue.shift()
                    node.children = group[node.deptId] && group[node.deptId].length ? group[node.deptId] : null
                    if (node.children) {
                        queue.push(...node.children)
                    }
                }
            }
            return root
        },
        getdetail () {
            var that = this
            let param = {
                'allowPaging': true,
                'business': 'GetHoistingJob',
                'data': {
                    'id': this.$route.query.id
                },
                'pageIndex': 0,
                'pageSize': 20,
                'tokenId': this.tokenId,
                'userId': this.userId
            }
            this.$axiosAjax.getConfigJson(
                param
            ).then(
                (res) => {
                    let newarr = res.data.data
                    this.dataList = {
                        id: newarr.Id, //	String	否	起重吊装作业申请ID（修改时存在，新增时为空）
                        projectName: newarr.ProjectName, //	String	否	项目名称
                        projectId: newarr.ProjectId, //	String	否	项目ID
                        deptName: newarr.DeptName, //	String	否	申请单位名称
                        deptId: newarr.deptId, //	String	否	申请单位ID
                        startDate: newarr.StartDate.substring(0, 10), //	String	否	申请拆除日期
                        endDate: newarr.EndDate.substring(0, 10), //	String	否	计划完工时间
                        DismantlingPart: newarr.DismantlingPart, //	String	否	拆除部位
                        DesignLabel: newarr.DesignLabel, //	String	否	设计砼标号
                        remark: newarr.remark, //	String	否	浇筑砼日期
                        PersonLiable: newarr.PersonLiable, //	String	否	责任人
                        PersonLiableid: newarr.PersonLiableid, //	String	否	责任人ID
                        EquipmentName: newarr.EquipmentName, //	String	否	设备名称及编号
                        RatedLoad: newarr.RatedLoad, //	String	否	额定荷载
                        LiftNameWeight: newarr.LiftNameWeight, //	String	否	吊物名称及重量
                        OperationArea: newarr.OperationArea, //	String	否	作业区域
                        DeviceOperator: newarr.DeviceOperator, //	String	否	设备操作人
                        DeviceOperatorid: newarr.DeviceOperatorid, //	String	否	设备操作人ID
                        CardNumber1: newarr.CardNumber1, //	String	否	上岗证号1
                        SignalSiSuogong: newarr.SignalSiSuogong, //	String	否	信号司索工
                        SignalSiSuogongid: newarr.SignalSiSuogongid, //	String	否	信号司索工ID
                        CardNumber2: newarr.CardNumber2, //	String	否	上岗证号2
                        personId: newarr.PersonId, //	String	否	申请人ID
                        personName: newarr.PersonName, //	String	否	申请人名称
                        subProjects: newarr.SubProjects,
                        ApproveInfo: newarr.ApproveInfo
                    }
                    this.crr = res.data.data.SubProjects

                    //  if(this.dataList.PersonId!=this.userInfo.userid){
                    //    this.yself = false;
                    //  }

                    //  this.subProjectsList = []
                    //   // let arr = res.data.data;
                    //   crr.forEach(
                    //       (item,index)=>{
                    //           let items = {};
                    //           items["Item"+item.DeptId] = "是";
                    //           this.subProjectsList[index]= Object.assign({},item,items)
                    //       }
                    //   )
                    this.changemovenew(this.dataList)

                    that.syself = res.data.data.CanEdit
                    if (res.data.data.ApproveInfo.length > 0) {
                        this.approveStatus = true
                    }
                }
            )
        },
        getPersonPage (type) {
            let param = {
                allowPaging: true,
                // business: 'getPersonPage',
                business: 'GetUserInfoByWork',
                data: {
                    deptid: this.userInfo.deptid,
                    type: type
                },
                pageIndex: 0,
                pageSize: 10000,
                tokenId: this.tokenId,
                userId: this.userId
            }
            this.$axiosAjax
                .getConfigJson(param)
                .then(res => {
                    if (res.data.code === 0) {
                        if (type === 0) {
                            this.workList0 = res.data.data
                        } else if (type === 3) {
                            this.workList1 = res.data.data
                        }
                    }
                })
                .catch(() => { })
        }
    }
}
</script>

<style scoped lang="less">
.boundedwork {
    background-color: #ebeef3;
    height: 100%;
}
.content {
    background-color: #ebeef3;
}
.c-top {
    background-color: #fff;
    padding-left: 20px;
}
.c-bottom {
    background-color: #fff;
    padding-left: 20px;
    margin-top: 12px;
    border-bottom: 1px solid #efeff4;
}
.c-list {
    padding: 0 20px 0 0;
    height: 50px;
    line-height: 50px;
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid #efeff4;
    align-items: center;
}
.c-left {
    color: #333;
    font-size: 14px;
    position: relative;
}
.c-left > i {
    position: absolute;
    top: -5px;
    right: -18px;
}
.c-right {
    color: #999;
    font-size: 14px;
    display: flex;
    align-items: center;
}
.c-select {
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    width: 200px;
    margin-right: 6px;
    text-align: right;
    font-size: 14px;
    color: #999;
}
.c-select input {
    text-align: right;
    background: #fff;
}
.c-select span {
    color: #999;
    font-size: 14px;
}
.c-btn {
    height: 113px;
    padding-top: 32px;
}
.c-submit {
    width: 200px;
    height: 40px;
    line-height: 40px;
    text-align: center;
    font-size: 15px;
    color: #fff;
    border-radius: 20px;
    background-color: #2269ff;
    margin: 0 auto;
}
.c-title {
    height: 50px;
    line-height: 50px;
    color: #1f69fc;
}
.selectcheck {
    background-color: #fff;
    // padding-left:20px;
}
.selecticn {
    height: 54px;
    display: flex;
    align-items: center;
}
.iconnew {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 1px solid #2467ff;
    position: relative;
    margin-right: 10px;
}
.iconnew.checked {
    background-color: #2467ff;
}
.iconnew.checked::before {
    border-left: 1px solid #fff;
    border-bottom: 1px solid #fff;
    height: 1.067vw;
    width: 2.133vw;
    position: absolute;
    top: 3px;
    left: 3px;
    content: '';
    -webkit-transform: rotate(-56deg);
    transform: rotate(-51deg);
}
.btnlist {
    background-color: #fff;
    padding-top: 6px;
    padding-left: 25px;
    border-top: 1px solid #ebeef3;
    border-bottom: 1px solid #ebeef3;
    padding-bottom: 26px;
}
.listtop {
    height: 56px;
    line-height: 56px;
    display: flex;
    justify-content: space-between;
    padding-right: 20px;
}
.list-t0 {
    color: #333;
}
.list-t1 {
    color: #666;
}
.firstlist {
    height: 23px;
    line-height: 23px;
    color: #666;
}
.c-btn {
    height: 113px;
    padding-top: 32px;
    background-color: #fff;
}
.c-submit {
    width: 200px;
    height: 40px;
    line-height: 40px;
    text-align: center;
    font-size: 15px;
    color: #fff;
    border-radius: 20px;
    background-color: #2269ff;
    margin: 0 auto;
}
.content-show {
    padding-left: 20px;
    background-color: #fff;
}
.c-l-l {
    height: 95px;
    padding-top: 28px;
    padding-right: 20px;
    border-bottom: 1px solid #ebeef3;
}
.textarea {
    width: 100%;
    border: 0;
    outline: none;
    margin-top: 10px;
    font-size: 14px;
    color: #999;
}
.showlist {
    overflow: hidden;
    // margin-bottom: -20px;
}
.position-horizontal-demo {
    height: 55px;
    line-height: 26px;
    padding-left: 20px;
    font-size: 16px;
    color: #666;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-right: 20px;
    background-color: #fff;
    border-bottom: 1px solid #ebeef3;
}
.showlisttime {
    height: 40px;
    line-height: 40px;
    width: 200px;
    text-align: right;
    font-size: 14px;
    color: #999;
}
.newlist {
    //  height:40vh;
    // overflow:scroll
}
.boundedwork .weui-cell {
    padding-top: 18px;
    padding-bottom: 18px;
    font-size: 13px;
    padding-left: 0;
}
.boundedwork .showlist .weui-cell {
    padding-right: 15px;
}
.newlistdemo {
    height: 50px;
    line-height: 50px;
    text-align: right;
    font-size: 16px;
    color: #333;
    padding-right: 20px;
    background: #f4f4f4;
}
.newsafework .rightmsg {
    color: #999;
    margin-right: -5px;
}
</style>
<style>
.newsafework .weui-cells {
    margin-top: 0;
}
.newsafework .c-right .weui-cell {
    padding-right: 0;
}
.newsafework .c-right .vux-cell-value {
    font-size: 14px;
    color: #999;
    line-height: 14px;
}
.newsafework .c-right .weui-cell_access .weui-cell__ft:after {
    width: 9px;
    height: 9px;
    border-color: #9c9c9c;
    margin-top: -6px;
}
.approveBox {
    border-top: 10px solid #ebeef2;
    background: #fff;
}
.approveBox .approveTit {
    height: 55px;
    line-height: 55px;
    margin-left: 20px;
    font-size: 15px;
    color: #2269ff;
    border-bottom: 1px solid #efeff4;
}
.approveBox .approveWrap {
    border-bottom: 5px solid #ebeef2;
}
.approveBox .approveWrap:last-child {
    /* border: none; */
}
</style>
